/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package hibernatemodelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Z510
 */
@Entity
@Table(name = "invitar")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Invitar.findAll", query = "SELECT i FROM Invitar i"),
    @NamedQuery(name = "Invitar.findById", query = "SELECT i FROM Invitar i WHERE i.id = :id"),
    @NamedQuery(name = "Invitar.findByAsitire", query = "SELECT i FROM Invitar i WHERE i.asitire = :asitire")})
public class Invitar implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "asitire")
    private boolean asitire;
    @JoinColumn(name = "idevento", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Evento idevento;
    @JoinColumn(name = "idinvitado", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Contacto idinvitado;
    @JoinColumn(name = "idanfitrion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Contacto idanfitrion;

    public Invitar() {
    }

    public Invitar(Integer id) {
        this.id = id;
    }

    public Invitar(Integer id, boolean asitire) {
        this.id = id;
        this.asitire = asitire;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean getAsitire() {
        return asitire;
    }

    public void setAsitire(boolean asitire) {
        this.asitire = asitire;
    }

    public Evento getIdevento() {
        return idevento;
    }

    public void setIdevento(Evento idevento) {
        this.idevento = idevento;
    }

    public Contacto getIdinvitado() {
        return idinvitado;
    }

    public void setIdinvitado(Contacto idinvitado) {
        this.idinvitado = idinvitado;
    }

    public Contacto getIdanfitrion() {
        return idanfitrion;
    }

    public void setIdanfitrion(Contacto idanfitrion) {
        this.idanfitrion = idanfitrion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Invitar)) {
            return false;
        }
        Invitar other = (Invitar) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "hibernatemodelo.Invitar[ id=" + id + " ]";
    }
    
}
